package com.xyz.study.design_mode.e_singleton;

import com.xyz.study.design_mode.e_singleton.mode.*;

/**
 * 生成实例：其一 ---- Singleton 单例模式
 * @author XYZ
 * @version 1.0.0
 * @since 2020/6/22
 */
public class SingletonMain {
    public static void main(String[] args) {
        //饿汉式
        HungrySingleton.instance().doSomething();
        //懒汉式
        LazySingleton.instance().doSomething();
        //DCL
        DoubleCheckLazySingleton.instance().doSomething();
        //静态内部类持有
        StaticInnerClassHolderSingleton.instance().doSomething();
        //枚举类持有
        EnumSingleton.SingletonInstanceEnum.INSTANCE.instance().doSomething();
    }
}
